<?php
//save employee modifications
if (isset($_POST['action'])) {
    switch ($_POST['action']) {
        case "Save Changes":
            $modifyEmployeeResult = modifyEmployee(
                    $_SESSION['userName'], $_SESSION['userPassHash'], $_POST['accName'], $_POST['dataHash'], $_POST['empFname'], $_POST['empLname'], $_POST['startDate'], $_POST['endDate'], $_POST['empStatus'], $_POST['address'], $_POST['email'], $_POST['phoneNum'], $_POST['wage']
            );
            break;
    }
}

$account = showEmployeeInfo(
        $_SESSION['userName'], $_SESSION['userPassHash'], $_SESSION['userName']
);
$_SESSION[$_SESSION['userName'] . 'employee'] = $account['hash'];
?>
<form action="" method="post">
    <div class="controls controls-row">
        <div class="control-group span2">
            <label class="control-label" for="accName">Account Name:</label>
            <div class="controls">
                <input class="span10" type="text" readonly name="accName" value="<?php echo($_SESSION['userName']); ?>" />
            </div>
        </div>
        <div class="control-group span2">
            <label class="control-label" for="empStatus">Status:</label>
            <div class="controls">
                <input class="span10" type="text" name="empStatus" readonly value="<?php echo($account[1]['empStatus']); ?>" />
            </div>
        </div>  
        <div class="control-group span2">
            <label class="control-label" for="wage">Wage:</label>
            <div class="controls">
                <input class="span6" type="text" readonly name="wage" value="<?php echo($account[1]['wage']); ?>" />
            </div>
        </div>
    </div>
    <label class="label">Personal Information</label>

    <div class="controls controls-row">
        <div class="control-group span3">
            <label class="control-label" for="empFname">First Name:</label>
            <div class="controls">
                <input class="span10" type="text" name="empFname" value="<?php echo($account[1]['empFname']); ?>" />
            </div>
        </div>
        <div class="control-group span3">
            <label class="control-label" for="empLname">Last Name:</label>
            <div class="controls">
                <input class="span10" type="text" name="empLname" value="<?php echo($account[1]['empLname']); ?>" />
            </div>
        </div>  
        <div class="control-group span3">
            <label class="control-label" for="startDate">Start Date:</label>
            <div class="controls">
                <input class="span10 datepicker" type="text" name="startDate" value="<?php echo($account[1]['startDate']); ?>" />
            </div>
        </div>
    </div>
    <div class="controls controls-row">
        <div class="control-group span3">
            <label class="control-label" for="address">Address:</label>
            <div class="controls">
                <input class="span10" type="text" name="address" value="<?php echo($account[1]['address']); ?>" />
            </div>
        </div>
        <div class="control-group span3">
            <label class="control-label" for="phoneNum">Phone:</label>
            <div class="controls">
               <input class="span10" type="text" name="phoneNum" value="<?php echo($account[1]['phoneNum']); ?>" />
            </div>
        </div>  
        <div class="control-group span3">
            <label class="control-label" for="email">Email:</label>
            <div class="controls">
                <input class="span10" type="text" name="email" value="<?php echo($account[1]['email']); ?>" />
            </div>
        </div>
    </div>
    <div class="control-group">
        <div class="controls">
            <input type="hidden" name="dataHash" value="<?php echo($account['hash']); ?>" />
            <input type="hidden" name="endDate" value="<?php echo($account[1]['endDate']); ?>" />
            <input type="submit" class="btn btn-primary" name="action" value="Save Changes" />  
        </div>
  </div>
</form>
